 /*
 * @description: 班级详情
 * @Author: along
 * @Date: 2021-06-05
 * @Last Modified by: along
 * @Last Modified time: 2021-06-05
 */
<template>
    <div class="socialClassDetail">
        <div class="content-wrapper">
            <!-- header -->
            <div class="header">
                <div class="header-title">
                    班级详情{{ formData.class_name ? '-' + formData.class_name : '' }}
                </div>
                <p
                    class="header_back"
                    @click="() => {
                        this.$router.push({
                            name: $route.query.from_type
                        })
                    }"
                >
                    返回
                </p>
            </div>

            <!-- 筛选-->
            <div class="__info">
                <p class="__items">
                    学校名称： {{ formData.school_name }}
                </p>
                <p class="__items">
                    学院名称： {{ formData.college_name }}
                </p>
                <p class="__items">
                    入学年份： {{ formData.enter_school_year | filterval }}
                </p>
                <p class="__items">
                    大学年限： {{ formData.education_year | filterval }}
                </p>
                <p class="__items">
                    班级QQ群人数： <span>{{ formData.class_group_number | filterval }}</span>
                </p>
                <p class="__items">
                    班级实际认证人数： <span>{{ formData.existed_class_group_user_count | filterval }}</span>
                </p>
            </div>

            <!-- table -->
            <el-table
                :data="tableData"
                height="100%"
                style="width: calc(100% - 64px);marginLeft: 32px"
                ref="tempLateName"
                class="data-table"
                v-loading="loading"
            >
                <el-table-column
                    type="index"
                    label="序号"
                    width="80"
                    align="center"
                />
                <el-table-column
                    prop=""
                    label="用户信息"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                    :width="190"
                >
                    <template slot-scope="scope">
                        <div class="__zsdx_wrap">
                            <div class="__top">
                                <p class="__top_name">
                                    {{ scope.row.true_name }}
                                </p>
                                <img
                                    v-if="scope.row.is_stuagent"
                                    class="__top_logo"
                                    src="http://cdn.zsdx.cn/student-app/images/stuagent.png"
                                >
                            </div>
                            <div class="__phone">手机号：{{ scope.row.phone }}</div>
                            <div class="__id">用户ID：{{ scope.row.student_no }}</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="agent_level"
                    label="精英等级"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                >
                    <template slot-scope="scope">
                        {{ scope.row.agent_level | filterLevel }}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="invite_code"
                    label="邀请码"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                />
                <el-table-column
                    prop="education_name"
                    label="学历"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                />
                <el-table-column
                    prop="join_class_time"
                    label="班级认证时间"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="left"
                >
                    <template slot-scope="scope">
                        {{ scope.row.join_class_time * 1000 | dateFormatter('yyyy/MM/dd HH:mm:ss') }}
                    </template>
                </el-table-column>
            </el-table>
            <!-- /table -->
        </div>
    </div>
</template>

<script>
import {back} from '@/mixin/back';
export default {
    mixins: [back],
    components: {
    },
    data() {
        return {
            class_no: '',
            loading: false,
            formData: {
                school_name: '',
                college_name: '',
                class_name: '',
                enter_school_year: '',
                education_year: '',
                class_group_number: '',
                existed_class_group_user_count: ''
            },
            tableData: [],
            authResult: {}
        };
    },
    filters: {
        filterLevel (val) {
            if(val === -1) return '--';
            if(val === 0) return 'E0';
            if(val === 1) return 'E1';
            if(val === 2) return 'E2';
            if(val === 3) return 'E3';
            if(val === 4) return 'E4';
            if(val === 5) return 'E5';
            if(val === 6) return 'E6';
            return '--';
        },
        filterval (val) {
            if(val) return val;
            return 0;
        }
    },
    mounted() {
        this.$store.commit('SET_HEADER', [{title: "APP后台"}, {title: '社交'}, {title: '班级管理'}, {title: '班级认证列表', path: '/student/social-class-auth'}, {title: '班级详情'}]);
        this.authResult = this.$route.meta.authResult;
        this.class_no = this.$route.query.class_no;
        this.getTableData();
    },
    methods: {
        /**
         * @description 获取表格数据
         */
        getTableData() {
            this.loading = true;
            this.$post('/student/region_class%5Cget_class_student_info', {
                class_no: this.class_no
            }, resp => {
                if (resp.code === 1) {
                    this.formData = {
                        ...resp.data
                    };
                    this.tableData = resp.data.student_list;
                    this.loading = false;
                } else {
                    this.$notify({
                        title: '失败',
                        message: resp.msg,
                        duration: 2000,
                        type: 'warning'
                    });
                }
            });
        },

        /**
         * @description 过滤函数
         */
        emptyFormatter(row, column, val) {
            if (!val) return '--';
            return val;
        }
    }
};
</script>

<style scoped lang="less">
.socialClassDetail {
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
    .content-wrapper {
        display: flex;
        height: calc(100% - 24px);
        flex-direction: column;
        position: relative;
        margin: 12px;
        background: #fff;
        box-sizing: border-box;
    }

    .__zsdx_wrap {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        .__top {
            display: flex;
            align-items: center;
            .__top_name {
                color: rgba(51, 51, 51, 1);
                font-size: 14px;
                font-weight: 500;
                margin-right: 6px;
            }
            .__top_logo {
                width: 28px;
                height: 14px;
            }
        }
        .__phone {
            height: 20px;
            color: rgba(153, 153, 153, 1);
            font-size: 14px;
            line-height: 20px;
            margin-top: 7px;
            margin-bottom: 5px;
        }
        .__id {
            height: 20px;
            color: rgba(153, 153, 153, 1);
            font-size: 14px;
            line-height: 20px;
        }
    }

    /*header*/

    .header {
        height: 68px;
        padding: 24px;
        box-sizing: border-box;
        box-shadow: 0px -1px 0px 0px #F0F2F5;
        display: flex;
        align-items: center;
        justify-content: space-between;
        // border-bottom: 1px solid #F0F2F5;

        .header-title {
            color: #333333;
            font-size: 20px;
            height: 20px;
            font-weight: 500;
            position: relative;
            margin: 24px 0 24px 12px;

            &::before {
                content: '';
                position: absolute;
                left: -8px;
                top: -1px;
                width: 3px;
                height: 20px;
                background: #1890FF;
            }
        }
        .header_back {
            font-size: 15px;
            color: #1890FF;
            cursor: pointer;
            margin-right: 9px;
            &:hover {
                text-decoration: underline;
            }
        }
    }

    .__info {
        width: calc(100% - 64px);
        margin-left: 32px;
        margin-bottom: 24px;
        background: rgba(239, 247, 255, 1);
        display: flex;
        flex-wrap: wrap;
        box-sizing: border-box;
        padding: 18px 32px;
        .__items {
            display: flex;
            align-items: center;
            color: rgba(51, 51, 51, 1);
            margin-right: 32px;
            span {
                color: rgba(47, 189, 179, 1);
                font-size: 14px;
                font-weight: 500;
            }
        }
    }

    .btn-view {
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 24px 24px 0;
    }

    .cursor_font {
        color: rgba(24, 144, 255, 1);
        cursor: pointer;
    }

    /*筛选*/

    .filter-view {
        margin: 24px 0;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        margin-bottom: 0px;
        .header-new-box {
            display: flex;
            align-items: center;
            color: #606266;
            white-space: nowrap;
            margin-left: 32px;
            margin-bottom: 24px;
            &-title {
                margin-right: 12px;
                white-space: nowrap;
            }
            .header-button {
                width: 84px;
                height: 36px;
                border: 1px rgba(24, 144, 255, 1) solid;
                border-radius: 4px;
                text-align: center;
                line-height: 36px;
                color: rgba(24, 144, 255, 1);
                font-size: 14px;
                font-weight: 500;
                cursor: pointer;
            }
            .header-rest {
                color: rgba(24, 144, 255, 1);
                font-size: 14px;
                cursor: pointer;
                font-weight: 500;
                &:hover {
                    text-decoration: underline;
                }
            }
        }
    }

    .status-wrapper {
        display: flex;
        align-items: center;

        .status-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            margin-right: 5px;

            &.success {
                background: #4CD964;
            }

            &.danger {
                background: #FF3030;
            }

            &.warning {
                background: #FFA72D;
            }

            &.normal {
                background: #C2C2C2;
            }
        }
    }

    /* 分页 */

    .pagination-wrapper {
        padding: 10px 32px;

        .el-pagination {
            float: right;
            padding: 0;
            background-color: transparent;
        }
    }

    .text-button {
        width: 180px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        text-align: left;
    }
    // 表格
    .data-table {
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }
        // 操作按钮
        .option-btn-group {
            .el-button {
                margin-left: 0;
                margin-right: 10px;
            }
        }
    }

    /deep/ .el-dialog__header {
        padding-top: 10px;
        box-shadow:0 1px 0 0 rgba(233,233,233,1);
        display: flex;
        align-items: center;
        background: #FAFAFA;
        border-radius: 4px 4px 0 0;
        .el-dialog__title {
            font-weight: 500;
            color: #333;
            font-size: 14px;
        }
        .el-icon-close:before {
            color: rgb(194,194,194);
            font-size: 17px;
            font-weight: bold;
        }
        .el-dialog__headerbtn {
            top: 14px;
        }
    }
    .dialog-footer {
        display: flex;
        justify-content: center;
    }
    /deep/ .el-table__fixed-right {
        right: 6px!important;
    }

    .el-popover-hover {
      border: none;
      background: transparent !important;
      border: none;
      outline: none;
      margin-left: -20px;
  }
}
</style>

<style lang="less">
.socialClassDetail {
    .el-icon-question {
        color: rgba(0, 0, 0, 0.3);
        margin-left: 2px;
    }
    .el-table .caret-wrapper {
        top: -1px;
    }
    .__title {
        color: rgba(51, 51, 51, 1);
        font-weight: 500;
    }
    .has-gutter {
        th .cell {
            color: rgba(51, 51, 51, 1);
            font-weight: 500;
        }
    }
    .el-dialog__header {
        padding-top: 10px;
        box-shadow:0px 1px 0px 0px rgba(233,233,233,1);
        display: flex;
        align-items: center;
        background: #FAFAFA;
        border-radius: 4px 4px 0 0;
        .el-dialog__title {
            font-weight: 500;
            color: #333;
            font-size: 14px;
        }
        .el-icon-close:before {
            color: rgb(194,194,194);
            font-size: 17px;
            font-weight: bold;
        }
        .el-dialog__headerbtn {
            top: 14px;
        }
    }
    .el-dialog__body {
        padding-left: 32px;
        padding-right: 32px;
    }
    .__model {
        .el-table__body-wrapper {
            height: auto !important;
        }
    }
}

.clearfixNew {
    .btn-prev, .btn-next {
        background-color: transparent !important;
    }
    .el-pager .active {
        background-color: transparent !important;
        color: #20A0FF !important;
    }
    .el-pager .number {
        background-color: transparent !important;
        color: #606266;
    }
    .el-pagination__jump {
        margin-left: 20px;
    }
}
.zd-popper-class {
    text-align: left !important;
}
</style>
